<div class="row-fluid admin_login" style="margin-top:30px; margin-bottom:50px;">
	<div class="span6 offset3">
		<div class="span12">
        	<h5><?php echo $this->translate('在线更新登录'); ?></h5>
        </div>
        <div class="well" style="margin-bottom:-8px;">
        	<form class="form-horizontal" id="update_login_form" name="update_login_form" method="POST" action="">
            	<div class="control-group">
                	<div class="alert alert-success">
                    <strong><?php echo sprintf($this->translate('请使用DBShop论坛帐户登录即可，如果您没有论坛帐户，可以 %s点击去这里注册%s'), '<a href="http://bbs.dbshop.net/" target="_blank">', '</a>'); ?></strong>
                    </div>
                </div>
                <div class="control-group">
                	<div class="message_one">
                    </div>
                </div>	
            	<div class="control-group">
            	<label for="input01" class="control-label" style="width:180px;"><strong><?php echo $this->translate('用户名'); ?>：</strong></label>
            		<div class="controls">
              		<input type="text" id="username" name="username" value="" class="span6">
            		</div>
          		</div>
            	<div class="control-group">
            	<label for="input01" class="control-label"  style="width:180px;"><strong><?php echo $this->translate('密码'); ?>：</strong></label>
            		<div class="controls">
              		<input type="password" id="password" name="password" class="span6">
            		</div>
          		</div>
                <div class="offset3">
            	<button class="btn btn-small btn-primary" type="submit" style="margin-left:15px;"><i class="icon-user icon-white"></i> <?php echo $this->translate('在线更新登录'); ?></button>
                </div>
            </form>
        </div>
    </div>
</div>
<script>
//管理员登录
$(document).ready(function() {
	$("#update_login_form").validate({
		success : function(label){
			label.addClass('validate_right').text('OK!');
		},
		rules: {
			username: {
				required: true
			},
			password: {
				required: true
			}
		},
		messages: {
			username: {
				required: "<?php echo $this->translate('请输入用户名！'); ?>"
			},
			password: {
				required: "<?php echo $this->translate('请输入用户密码！'); ?>"
			}
		},
		submitHandler:function(){
			admin_login();
		}
	});
});
//管理员登录
function admin_login() {
	$.post("<?php echo $this->url('package/default', array('controller'=>'package', 'action'=>'updateUserLogin')); ?>",$('#update_login_form').formSerialize(),
			function(data){
				if(data == 'true') {
					window.location.href="<?php if(!empty($this->http_referer)) echo $this->http_referer; else echo $this->url('package/default'); ?>";
					return true; 
				} else {
					show_message('.message_one','<?php echo date("Y-m-d H:i:s",time()); ?>','<?php echo $this->translate('登录失败，用户名或密码错误，请重新登录！'); ?>','alert-error');
				}
		  });	
}
</script> 
